<template>
  <div id="freight">
    <c-title :hide="false" text="模板管理"></c-title>
    <div class="goods-manage">
      <div class="release-goods">
        <div class="release-a">
          <icon class="iconfont icon-block"></icon>
        </div>
        <div class="span">模板数量：{{ commodity_data.length }}</div>
        <div @click="routeTake" class="release-b">
          <div class="span">发布模板</div>
        </div>
        <!-- <router-link :to="fun.getUrl('AddFreightTemplate', { store_id: store_id })" tag="div" class="item-box">
            <div class="release-b">
                <div class="span">发布模板{{ store_id }}</div>
            </div>
        </router-link> -->
      </div>
      <div class="goods-list">
        <div class="goods-list" v-for="(item,index) in commodity_data" :key="index">
          <div class="ul goods-b">
            <div class="title-box" style="position: relative;">
              <div class="li name">
                <div> 模板名称：{{ item.list.dispatch_name }} </div>
                <div @click="moreEvent(index)" class="morebtn" style="position: absolute;top: 0;right: 0;">
                  <icon class="iconfont icon-more"></icon>
                </div>
                <div class="more" v-if="item.edit_active">
                  <div class="top">
                    <div class="ul">
                      <div @click="editJumpEvent(index,item.list.id)" class="li">
                        <icon class="iconfont icon-edit"></icon>
                        <div class="span">编辑</div>
                      </div>
                      <div @click="openDialog(index,item.list.id)" class="li">
                        <icon class="iconfont icon-delete"></icon>
                        <div class="span">删除</div>
                      </div>
                    </div>
                  </div>
                  <div class="bottom">
                    <div class="icon">
                      <icon class="iconfont icon-down"></icon>
                    </div>
                  </div>
                </div>
              </div>
            </div>
            <div class="li title-box"> 计费方式: {{ item.list.calculate_type == 0 ? "按重" : "按件" }} </div>
            <div class="li title-box" v-if="item.list.calculate_type == 0">
              <div class="flex" style="display: flex;">
                <div class="flex flex-1">首重: {{ item.list.first_weight }}</div>
                <div class="flex flex-1">首重价格: {{ item.list.first_weight_price }}</div>
              </div>
              <div class="flex">
                <div class="flex flex-1">续重: {{ item.list.another_weight }}</div>
                <div class="flex flex-1">续重价格: {{ item.list.another_weight_price }}</div>
              </div>
            </div>
            <div class="li title-box" v-if="item.list.calculate_type == 1">
              <div class="flex">
                <div class="flex flex-1">首件: {{ item.list.first_piece }} </div>
                <div class="flex flex-1">首件价格: {{ item.list.first_piece_price }} </div>
              </div>
              <div class="flex">
                <div class="flex flex-1">续件: {{ item.list.another_piece }} </div>
                <div class="flex flex-1">续件价格: {{ item.list.another_piece_price }} </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import freight_template_controller from "./freightTemplate_controller";

export default freight_template_controller;
</script>

<style lang="scss" rel="stylesheet/scss" scoped>
.goods-manage .release-goods {
  background-color: #fff;
  border-bottom: 1px solid #ebebeb;
  display: flex;
  font-size: 16px;
  height: 48px;
  line-height: 48px;
  position: relative;
}

.goods-manage .release-goods .release-a {
  align-items: center;
  display: flex;
  height: 48px;
  justify-content: center;
  width: 48px;
}

.goods-manage .release-goods .release-a icon {
  color: #f15353;
  font-size: 24px;
}

.goods-manage .release-goods .release-b {
  background-color: #f15353;
  border-radius: 13px;
  color: #fff;
  display: block;
  font-size: 14px;
  height: 26px;
  line-height: 26px;
  padding: 0 10px;
  position: absolute;
  right: 14px;
  top: 11px;
}

.goods-manage .goods-list .goods-list {
  background-color: #fff;
  border-bottom: 1px solid #ebebeb;
  display: flex;
  padding-bottom: 10px;
  padding-left: 10px;
  padding-top: 10px;
}

.goods-manage .goods-list .goods-list .goods-a {
  background-color: #ccc;
  height: 80px;
  overflow: hidden;
  width: 80px;
}

.goods-manage .goods-list .goods-list .goods-a image {
  height: 100%;
  width: 100%;
}

.goods-manage .goods-list .goods-list .goods-b {
  line-height: 20px;
  margin: 0 14px;
  text-align: left;
  width: 100%;
}

.goods-manage .goods-list .goods-list .goods-b .name {
  line-clamp: 2;
  -webkit-box-orient: vertical;
  display: -webkit-box;
  font-size: 14px;
  height: 40px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.goods-manage .goods-list .goods-list .goods-b .title-box .p {
  border-radius: 8px;
  color: #fff;
  float: right;
  font-size: 12px;
  padding: 2px 6px;
}

.goods-manage .goods-list .goods-list .goods-b .title-box .red {
  background: #f15353;
  border: 1px solid #f15353;
}

.goods-manage .goods-list .goods-list .goods-b .title-box .gray {
  background: #8c8c8c;
  border: 1px solid #8c8c8c;
}

.goods-manage .goods-list .goods-list .goods-b .price {
  color: #f15353;
  font-size: 16px;
}

.goods-manage .goods-list .goods-list .goods-b .price .span {
  font-size: 12px;
}

.goods-manage .goods-list .goods-list .goods-b .info {
  color: #8c8c8c;
  font-size: 12px;
  overflow: visible;
  position: relative;
}

.goods-manage .goods-list .goods-list .goods-b .info .font {
  display: inline-block;
  margin-right: 20px;
}

.goods-manage .goods-list .goods-list .goods-b .info .morebtn {
  display: inline-block;
  height: 27px;
  width: 16px;
}
.morebtn {
  display: inline-block;
  height: 27px;
  width: 16px;
}

.goods-manage .goods-list .goods-list .goods-b .info .icon-more {
  position: absolute;
  right: 0;
  z-index: 2;
}
.icon-more {
  position: absolute;
  right: 0;
  z-index: 2;
}

.goods-manage .goods-list .goods-list .goods-b .info .more {
  background: rgba(51,51,51,.9);
  border-radius: 4px;
  color: #f0f0f0;
  overflow: visible;
  position: absolute;
  right: 0;
  top: -44px;
  width: 88px;
}
.more {
  background: rgba(51,51,51,.9);
  border-radius: 4px;
  color: #f0f0f0;
  overflow: visible;
  position: absolute;
  right: 0;
  top: -44px;
  width: 88px;
}

.goods-manage .goods-list .goods-list .goods-b .info .more .ul {
  display: flex;
  justify-content: center;
}
.more .ul {
  display: flex;
  justify-content: center;
}

.goods-manage .goods-list .goods-list .goods-b .info .more .ul .li {
  flex: 1;
  text-align: center;
}
.more .ul .li {
  flex: 1;
  text-align: center;
}

.goods-manage .goods-list .goods-list .goods-b .info .more .ul .li icon {
  display: block;
}
.more .ul .li icon {
  display: block;
}

.goods-manage .goods-list .goods-list .goods-b .info .more .icon {
  overflow: hidden;
  position: absolute;
  right: 0;
  top: 36px;
}
.more .icon {
  overflow: hidden;
  position: absolute;
  right: 0;
  top: 36px;
}

.goods-manage .goods-list .goods-list .goods-b .info .more .icon icon {
  color: rgba(51,51,51,.9);
  font-size: 24px;
}
.more .icon icon {
  color: rgba(51,51,51,.9);
  font-size: 24px;
}
.goods-manage .goods-list .goods-list:last-child {
  border: none;
}

.goods-manage .goods-list .goods-list .goods-b .red {
  color: #f15353;
}

.goods-manage .goods-list .goods-list .goods-b .gray {
  color: #8c8c8c;
}
.flex {
  display: flex;
}
.flex-1 {
  flex: 1;
}
</style>
